package com.tcl.bodycoach;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.view.View;
import android.widget.Toast;

import java.io.File;

public class UnzipTask extends AsyncTask<String, Void, Boolean> {
    private Context mContext;

    public UnzipTask(Context mContext) {
        this.mContext = mContext;
    }

    @Override
    protected Boolean doInBackground(String... strings) {
        String zipPath = strings[0];
        File dstFile = mContext.getExternalFilesDir("assets");

        return FileUtils.unzipAssetFile(mContext, zipPath, dstFile);
    }



    @Override
    protected void onPostExecute(Boolean aBoolean) {
        super.onPostExecute(aBoolean);
        SharedPreferences preferences = mContext.getSharedPreferences("user", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = preferences.edit();
        editor.putBoolean("resource", aBoolean);
        editor.commit();
        LogUtils.i("Uzipfinished");
    }
}
